﻿using CleanArchitecture.Infrastructure.Entities.System.DataDic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.DataDic
{
    /// <summary>
    /// Represents a customer role mapping configuration
    /// </summary>
    public partial class SystemDataDicButtonMap : NowaEntityTypeConfiguration<SystemDataDicButton>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<SystemDataDicButton> builder)
        {
            builder.ToTable("sys_datadic");
            builder.HasKey(sysbtn => sysbtn.Id);
            builder.Property(sysbtn => sysbtn.FKSystemDataDicTreeId).HasColumnName("FK_DataDicTreeId");
            builder.Property(sysbtn => sysbtn.ButtonName).HasMaxLength(255).IsRequired();
            builder.Property(sysbtn => sysbtn.DisplayName).HasMaxLength(255);
            builder.Property(sysbtn => sysbtn.ButtonClass).HasMaxLength(255);
            builder.Property(sysbtn => sysbtn.IconCssClass).HasMaxLength(255);
            builder.Property(sysbtn => sysbtn.EventName).HasMaxLength(255).IsRequired();
            builder.HasOne(sysbtn => sysbtn.BelongTreeNode)
                .WithMany()
                .HasForeignKey(sysbtn => sysbtn.FKSystemDataDicTreeId)
                .IsRequired();
            base.Configure(builder);
        }

        #endregion
    }
}
